﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiViewportTraits : OdGiSubEntityTraits
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiViewportTraits(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGiViewportTraits_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiViewportTraits obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiViewportTraits()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiViewportTraits(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdGiViewportTraits cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiViewportTraits_cast(OdRxObject.getCPtr(pObj));
			OdGiViewportTraits result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiViewportTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiViewportTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiViewportTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiViewportTraits_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiViewportTraits_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiViewportTraits_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdGiViewportTraits createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiViewportTraits_createObject();
			OdGiViewportTraits result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiViewportTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiViewportTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiViewportTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool isDefaultLightingOn()
		{
			bool result = GlobalsPINVOKE.OdGiViewportTraits_isDefaultLightingOn(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setDefaultLightingOn(bool b)
		{
			GlobalsPINVOKE.OdGiViewportTraits_setDefaultLightingOn(this.swigCPtr, b);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdGiViewportTraits.DefaultLightingType defaultLightingType()
		{
			OdGiViewportTraits.DefaultLightingType result = (OdGiViewportTraits.DefaultLightingType)GlobalsPINVOKE.OdGiViewportTraits_defaultLightingType(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setDefaultLightingType(OdGiViewportTraits.DefaultLightingType arg0)
		{
			GlobalsPINVOKE.OdGiViewportTraits_setDefaultLightingType(this.swigCPtr, (int)arg0);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setAmbientLightColor(OdCmEntityColor color)
		{
			GlobalsPINVOKE.OdGiViewportTraits_setAmbientLightColor(this.swigCPtr, OdCmEntityColor.getCPtr(color));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdCmEntityColor ambientLightColor()
		{
			OdCmEntityColor result = new OdCmEntityColor(GlobalsPINVOKE.OdGiViewportTraits_ambientLightColor(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setContrast(double contrast)
		{
			GlobalsPINVOKE.OdGiViewportTraits_setContrast(this.swigCPtr, contrast);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual double contrast()
		{
			double result = GlobalsPINVOKE.OdGiViewportTraits_contrast(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setBrightness(double brightness)
		{
			GlobalsPINVOKE.OdGiViewportTraits_setBrightness(this.swigCPtr, brightness);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual double brightness()
		{
			double result = GlobalsPINVOKE.OdGiViewportTraits_brightness(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setBackground(OdDbStub bg)
		{
			GlobalsPINVOKE.OdGiViewportTraits_setBackground(this.swigCPtr, OdDbStub.getCPtr(bg));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdDbStub background()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGiViewportTraits_background(this.swigCPtr);
			OdDbStub result = (intPtr == IntPtr.Zero) ? null : new OdDbStub(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setRenderEnvironment(OdDbStub re)
		{
			GlobalsPINVOKE.OdGiViewportTraits_setRenderEnvironment(this.swigCPtr, OdDbStub.getCPtr(re));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdDbStub renderEnvironment()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGiViewportTraits_renderEnvironment(this.swigCPtr);
			OdDbStub result = (intPtr == IntPtr.Zero) ? null : new OdDbStub(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setRenderSettings(OdDbStub rs)
		{
			GlobalsPINVOKE.OdGiViewportTraits_setRenderSettings(this.swigCPtr, OdDbStub.getCPtr(rs));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdDbStub renderSettings()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGiViewportTraits_renderSettings(this.swigCPtr);
			OdDbStub result = (intPtr == IntPtr.Zero) ? null : new OdDbStub(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setToneOperatorParameters(OdGiToneOperatorParameters arg0)
		{
			GlobalsPINVOKE.OdGiViewportTraits_setToneOperatorParameters(this.swigCPtr, OdGiToneOperatorParameters.getCPtr(arg0));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void toneOperatorParameters(OdGiToneOperatorParameters arg0)
		{
			GlobalsPINVOKE.OdGiViewportTraits_toneOperatorParameters(this.swigCPtr, OdGiToneOperatorParameters.getCPtr(arg0));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		public enum DefaultLightingType
		{
			kOneDistantLight,
			kTwoDistantLights,
			kBackLighting
		}
	}
}
